package com.hqyj.controller;

import com.hqyj.config.Test;
import com.hqyj.exception.MyarithmeticException;
import com.hqyj.service.TestService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目:demo-springboot-230701
 * 描述:
 * 时间:2023/9/25 9:14
 * 作者:admin
 * 版本:1.0
 **/
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    Test test;

    @Autowired
    TestService testService;


    @GetMapping("/test")
    public String test() throws MyarithmeticException {

        System.out.println("邮箱:"+test.getDd());
        String kok = testService.test();
        System.out.println("=="+kok);
        try{
            int num =1/0;
        }catch (Exception e){
            throw  new MyarithmeticException("新增失败","除数不能为 0",300);
        }
        return "OK111";
    }
}
